<?php
	
	namespace Aspic\Database\Sqlite;
	use Aspic\Database as Db;
	
	class Util extends Db\AbstractUtil {
		
		public function getAssociationPairString($name, $sign, $value, $isWhereExpression) {
			if($isWhereExpression AND $value === null) {
				if($sign == '=') {
					$sql = $name.' IS NULL';
				}
				else {
					$sql = $name.' IS NOT NULL';
				}
			}
			else {
				$sql = parent::getAssociationPairString($name, $sign, $value, $isWhereExpression);
			}
			
			return $sql;
		}
		
		public static function geSqlType($type, $length) {
			$typeName = '';
			
			if ($type == 'string') {
				return 'TEXT';
			}
			elseif ($type == 'integer') {
				$typeName = 'INTEGER';
			}
			elseif ($type == 'float' OR $type == 'double') {
				$typeName = 'REAL';
			}
			elseif ($type == 'boolean') {
				$typeName = 'NUMERIC';
			}
			
			return $typeName;
		}
		
	}	
	
?>